package com.telit.firecommand.dao;





import com.telit.firecommand.dto.FirePositionDTO;
import com.telit.firecommand.vo.FireStatusTraceVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;


public interface FireAlarmsDao    {

    List<FireStatusTraceVO>findFireStatusTrace(@Param("fireId") String fireId);

//    //查询火情来源对应字典
    @Select(" SELECT  b.config_name as name  FROM fire_config_name_code a INNER JOIN fire_config_name_code b ON A.ID = b.parent_id  WHERE a.config_code = #{type} and b.config_code=#{sourceType}  limit 1")
   String  selectOneByDictType(@Param("type") String type,@Param("sourceType") String sourceType);

     Integer isOkRescue(@Param("districtCode") String districtCode);


     @Select("select is_rescue from comm_fire_alarm where id=#{fireId}")
     Integer isRescue(@Param("fireId") String fireId);


     @Update("update comm_fire_alarm  set is_rescue=0 where id=#{fireId}")
     void beginRescue(@Param("fireId") String fireId);


    @Update("update comm_fire_alarm  set is_rescue=1,status=4 where id=#{fireId}")
    void endRescue(@Param("fireId") String fireId);


    void updateFireStatus(@Param("status") Integer status,
                          @Param("recieveTime") Date recieveTime,
                          @Param("confirmTime") Date confirmTime,
                          @Param("fireJudgmentType") Integer fireJudgmentType,
                          @Param("isTrue") Integer isTrue,@Param("fireId") String fireId);



    void updatePosition(FirePositionDTO firePositionDTO);


    void updateAlarmsRepeat(@Param("alarmsId") String alarmsId,@Param("repeatIdStatus") Integer repeatIdStatus,@Param("hasDelete") Integer hasDelete);

    @Update("update comm_fire_alarm  set origin_fire_id=#{alarmsId} where id=#{repeatId}")
    void updateOriginFireId(@Param("alarmsId") String alarmsId,@Param("repeatId") String repeatId);



    void isReadFire(@Param("fireId") String fireId,@Param("isWatchman") Integer isWatchman);
}